package cn.jdbc.mysql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

//mysql update
public class Test05 {
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql://localhost:3306/test";
        String name="root";
        String password="root";
        Connection connection = DriverManager.getConnection(url, name,
                password);
        Statement statement = connection.createStatement();
        int i = statement.executeUpdate("UPDATE `table-user`\n" +
                " SET `username`='王伟',`password`=MD5('5665')\n" +
                "WHERE id=6;");
      if (i!=0)
          System.out.println("更新成功");
    }
}
